1. Field of the Invention
This invention generally relates to computer operating systems (OSs) and, more particularly, to an OS with the capability to offload central processing unit (CPU) task scheduling to a hardware device.
2. Description of the Related Art
As noted in Wikipedia, an operating system (OS) is an interface between hardware and user that is responsible for the management and coordination of activities and the sharing of the resources of a computer, that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating system is to handle the resource allocation and access protection of the hardware. This relieves application programmers from having to manage these details.
Operating systems offer a number of services to application programs and users. Applications access these services through application programming interfaces (APIs) or system calls. By invoking these interfaces, the application can request a service from the operating system, tem, pass parameters, and receive the results of the operation. Users may also interact with the operating system with some kind of software user interface like typing commands by using command line interface (CLI) or using a graphical user interface. For hand-held and desktop computers, the user interface is generally considered part of the operating system. On large multi-user systems like Unix and Unix-like systems, the user interface is generally implemented as an application program that runs outside the operating system. While servers generally run Unix or some Unix-like operating system, embedded system markets are split amongst several operating systems, although the Microsoft Windows line of operating systems has almost 90% of the client PC market.
Multitasking refers to the running of multiple independent computer programs on the same computer; giving the appearance that it is performing the tasks at the same time. Since most computers can do at most one or two things at one time, this is generally done via time-sharing, which means that each program uses a share of the computer's time to execute.
An operating system kernel contains a piece of software called a scheduler which determines how much time each program will spend executing, and in which order execution control should be passed to programs. Control is passed to a process by the kernel, which allows the program access to the CPU and memory. Later, control is returned to the kernel through some mechanism, so that another program may be allowed to use the CPU. This so-called passing of control between the kernel and applications is called a context switch.
An early model which governed the allocation of time to programs was called cooperative multitasking. In this model, when control is passed to a program by the kernel, it may execute for as long as it wants before explicitly returning control to the kernel. This means that a malicious or malfunctioning program may not only prevent any other programs from using the CPU, but it can hang the entire system if it enters an infinite loop.
The philosophy governing preemptive multitasking is that of ensuring that all programs share time on the CPU. This implies that all programs must be limited in how much time they are allowed to spend on the CPU without being interrupted. To accomplish this, modern operating system kernels make use of a timed interrupt. A protected mode timer is set by the kernel which triggers a return to supervisor mode after the specified time has elapsed. On many single user operating systems cooperative multitasking is perfectly adequate, as home computers generally run a small number of well tested programs.
FIG. 1 is a schematic diagram depicting a computer system with a plurality of software applications, an OS, and a plurality of CPUs (prior art). An operating system may use a number of different scheduling algorithms. Some examples of these algorithms include strict priority, weighted round robin, deficit round robin, and simple round robin. All the algorithms run under the control of software module in the OS.
FIG. 2 is a flowchart illustrating the performance of task scheduling in the system of FIG. 1 (prior art). In Step 100 an application creates a task. In Step 102 the OS receives the task and creates a task database in Step 104. In Step 106 the OS task schedules accesses a task form the task database. A determination is made in Step 108 if the task is ready to be performed. If yes, the task is performed in Step 110. A determination is made in Step 112 if more CPU time is needed. If no, the task is ended (sleep task) in Step 114. Otherwise, more CPU time is scheduled in Step 116, and the flowchart returns to Step 106.
In today's fast packet processing requirement, sometimes the task scheduling becomes as computationally intensive as processing the packet, creating a large overhead. This overhead makes the system very slow as CPU is busy performing the scheduling algorithms in the background. Regardless of the algorithm used, and how much the software algorithm is optimized, there is always going to be some overhead for software-based scheduling, as scheduling is a process that must be supported by the CPU.
In addition, the system of FIG. 1 does not scale well across multiple CPUs. It is difficult for the OS to provide infrastructure for task grouping, task hierarchy, and task distribution to multiple cores at runtime depending upon the application. Such as system cannot create pipeline processing of tasks across CPUs for task processing parallelism, and it can't work with multiple operating systems running in multiprocessor or uniprocessor systems.
It would be advantageous if more CPU time could be made available by reducing the number of CPU operations needed to support OS task scheduling.
It would be advantageous if the OS could at least partially offload task scheduling to a hardware device that operates independently of the CPU.